package com.cmic.rcs.enhance.message.g5.core.common;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true) // 继承父类的equals和hashCode方法
@ToString(callSuper = true) // 继承父类的toString方法
public class ResponseData<T> extends Response {
    /**
     * 结果数据
     */
    private T data;

    public static <T> ResponseData<T> OK(T data) {
        return new ResponseData<>(ReturnCodeEnum.SUCCESS, data);
    }

    public static ResponseData OK() {
        return new ResponseData(ReturnCodeEnum.SUCCESS);
    }

    public ResponseData(ReturnCodeEnum returnCodeEnum, T data) {
        super(returnCodeEnum.getCode(), returnCodeEnum.getMsg());
        this.data = data;
    }

    public ResponseData(ReturnCodeEnum returnCodeEnum) {
        super(returnCodeEnum.getCode(), returnCodeEnum.getMsg());
    }
}
